let url_js = require("../../utils/url.js");
let api = require("../../utils/apiRequest.js");
let common_js = require("../../utils/common.js");
Page({
    data: {
        ruleBox: false,
        ruleBox2: false,
        info:'',
        refreshInfo:'',
        faceUrl:'',
        howUrl: url_js.imgUrl + "how.jpg",
    },
    ctrlBox(){
    	this.setData({
    		ruleBox:!this.data.ruleBox
    	})
    },
    ctrlBox2(){
    	this.setData({
    		ruleBox2:!this.data.ruleBox2
    	})
    },
    onShareAppMessage(res){
        return {
            title:this.data.refreshInfo?this.data.refreshInfo.shareCampaignVo.shareTitle:'',
            imageUrl:this.data.refreshInfo?this.data.refreshInfo.shareCampaignVo.shareImag:'',
            path:`/pages/invite2/invite2?initiatorId=${this.data.refreshInfo.shareCampaignCouponVo.initiatorId}`
        }
    },
    onShow(){
        wx.hideShareMenu();
        //获取配置信息
        api.wxRequest2(url_js.getSetting2, {}).then(res => {
            if(res.code===200){
                this.setData({
                    info:res.result.shareCampaignVo
                })
            }
        }).catch(err => {
            common_js.log(err);
        });
        //刷新
        api.wxRequest(url_js.refreshsharecoupon2).then(res => {
            if(res.code===200){
                this.setData({
                    refreshInfo:res.result
                })
            }
        }).catch(err => {
            common_js.log(err);
        });
        //生成面对面邀请图片
        api.wxRequest(url_js.generateCode).then(res => {
            if(res.code===200){
                this.setData({
                    faceUrl:res.result
                })
            }
        }).catch(err => {
            common_js.log(err);
        });
    },
    onLoad: function(op) {
    },
    stop(){return false}
})